const db=require('../config/db.js'),
userModel='../schema/user.js';
const TodolistDb=db.Todolist;
const bcrypt=require('bcryptjs');
const User = TodolistDb.import(userModel);
const createUser=async function(data){
	let password=bcrypt.hashSync(data.password)
	await User.create({
		username:data.username,
		password:password
	})
	return true
}
const getUserById=async function(id){
	const userInfo=await User.findOne({
		where:{
			id:id
		}
	})
}
const getUserByName=async function(name){
	const userInfo=await User.findOne({
		where:{
			username:name
		}
	})
	return userInfo
}
module.exports={
	getUserById,
	getUserByName,
	createUser
}